package com.blacktry.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blacktry.mapper.BookMapper;
import com.blacktry.pojo.Book;
import com.blacktry.pojo.Lend;
import com.blacktry.mapper.LendMapper;
import com.blacktry.pojo.User;
import com.blacktry.service.LendService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author blackTry
 * @since 2021-01-31
 */
@Service
public class LendServiceImpl extends ServiceImpl<LendMapper, Lend> implements LendService {

    @Autowired
    private LendMapper lendMapper;

    @Override
    public Page<Lend> selectPage(Integer currentPage, Integer size) {
        Page<Lend> page = new Page<>(currentPage, size);
        return lendMapper.selectPage(page, null);
    }

    @Override
    public Page<Lend> selectSuccessPage(Integer currentPage, Integer size) {
        Page<Lend> page = new Page<>(currentPage, size);
        QueryWrapper<Lend> wrapper = new QueryWrapper<>();
        wrapper
                .eq("state","1");
        return lendMapper.selectPage(page, wrapper);
    }

    @Override
    public Page<Lend> selectNowPage(Integer currentPage, Integer size) {
        Page<Lend> page = new Page<>(currentPage, size);
        QueryWrapper<Lend> wrapper = new QueryWrapper<>();
        wrapper
                .eq("state","0");
        return lendMapper.selectPage(page, wrapper);
    }
}
